<template>
  <a-layout class="basic-layout">
    <a-layout-sider :theme="theme" class="sider">
      <router-link :to="{ path: '/' }">
        <h1 class="logo-text">{{ title }}</h1>
      </router-link>
      <side-menu />
    </a-layout-sider>
    <a-layout>
      <a-layout-header :theme="theme">
        <div></div>
        <header-avatar />
      </a-layout-header>
      <a-layout-content>
        <div class="layout-content">
          <route-view />
        </div>
        <global-footer />
      </a-layout-content>
    </a-layout>
  </a-layout>
</template>

<script>
import { mapState } from 'vuex';
import SideMenu from './components/SideMenu';
import GlobalFooter from './components/GlobalFooter';
import HeaderAvatar from './components/HeaderAvatar';
import RouteView from './RouteView';

export default {
  components: {
    SideMenu,
    GlobalFooter,
    HeaderAvatar,
    RouteView,
  },
  computed: {
    ...mapState({
      title: (state) => state.setting.title,
      theme: (state) => state.setting.theme,
    }),
  },
};
</script>

<style lang="less">
.basic-layout {
  min-height: 100vh;
  width: 100%;
  height: 100%;
  .sider {
    box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.06);
    z-index: 10;
  }
  .ant-menu-inline,
  .ant-menu-vertical,
  .ant-menu-vertical-left {
    border-right: 0;
  }
  .ant-layout-header {
    display: flex;
    padding: 0 5px;
    justify-content: space-between;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    position: relative;
    z-index: 1;
  }
  .ant-layout-content {
    overflow-y: auto;
  }
}
.logo-text {
  height: 64px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  position: relative;
  z-index: 10;
}
.layout-content {
  margin: 20px;
}
</style>
